import { DailyListNormal } from "./DailyListNormal";
import { ResouceConst } from "../../../../component/gconst/ResouceConst";
import { ImagesConst } from "../../../resource/ImagesConst";
import { ObjectPool } from "../../../../../com/gengine/utils/pools/ObjectPool";
import { DailyWelfareItem } from "../item/DailyWelfareItem";
import { ScrollPolicy } from "../../../../../fl/controls/ScrollPolicy";
type int = number;
//class DailyWelfareList
    
    export  class DailyWelfareList extends DailyListNormal
    {
        constructor()
        {
            super();
            return;
        }

        protected /* override */ initUI(): void
        {
            this.initWidth();
            _bg = ResouceConst.getScaleBitmap(ImagesConst.WindowCenterB);
            _bg.width = _listWidth;
            _bg.height = _height;
            addChild(_bg);
            createListBody();
            _scrollPane.y = 0;
            return;
        }

        protected /* override */ initWidth(): void
        {
            _listWidth = 662;
            _listHeight = 400;
            return;
        }

        public /* override */ updateData(arg1: Array<any>, arg2: int, arg3: int=0): void
        {
            var loc1=0;
            var loc2=0;
            var loc3=null;
            var loc4=null;
            dispose();
            if (arg1 != null) 
            {
                loc2 = arg1.length;
                while (loc1 < loc2) 
                {
                    loc3 = arg1[loc1];
                    loc4 = ObjectPool.getObject(DailyWelfareItem);
                    if (loc3 != null) 
                    {
                        loc4.updateData(loc3);
                        _bodySprite.addItem(loc4);
                        if (loc1 == 0) 
                        {
                            loc4.mouseDown(true);
                            _lastItem = loc4;
                        }
                    }
                    ++loc1;
                }
                if (loc2 <= 4) 
                {
                    _scrollPane.verticalScrollPolicy = ScrollPolicy.OFF;
                }
                else 
                {
                    _scrollPane.verticalScrollPolicy = ScrollPolicy.AUTO;
                }
            }
            _bodySprite.redraw();
            _scrollPane.refreshPane();
            _scrollPane.update();
            _scrollPane.horizontalScrollPosition = 0;
            selectedItemByType(arg3);
            return;
        }
    }
